// ParticleEffect class
// contains a list of Particles to control
// the behaviour of a set of sprite effects
// that fly around the screen
#pragma once

#include "Physics//particle.h"
#include <vector>
#include "d3dUtil.h"
#include "SpriteData.h"

class ParticleEffect
{
private:
	typedef std::vector<physics::Particle*> Particles;
	
	Particles			mParticles;
	D3DXMATRIX			mViewProj;
	bool				mAffectedByGravity;
	physics::Vector3	mGravity;
	ID3DXSprite			*mSprite;

public:
	//ParticleEffect(ID3DXSprite *sprite, int numParticles, SpriteData &spriteData, float minScale, float maxScale, float minVel, float maxVel, float minAngVel, float maxAngVel, float lifeTime, physics::Vector3 position, bool alphaFade = false, physics::Vector3 gravity = physics::Vector3(0, 0, 0));
	ParticleEffect(ID3DXSprite *sprite);
	~ParticleEffect();

	void AddParticles(int numParticles, SpriteData &spriteData, float minScale, float maxScale, float minVel, float maxVel, float minAngVel, float maxAngVel, float lifeTime, physics::Vector3 position, bool alphaFade = false, physics::Vector3 gravity = physics::Vector3(0, 0, 0));

	void UpdateViewProjMatrix(D3DXMATRIX &viewProj);

	void Update(float dt);

	void Render();

	void EndFrame();

	bool HasStopped();
};